import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Editor from '../views/Editor.vue'
import Temp from '../views/Temp.vue'
import TestTreeSelect from '../views/testTreeSelect.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/temp',
    name: 'Temp',
    component: Temp
  },
  {
    path: '/tree-select',
    name: 'TestTreeSelect',
    component: TestTreeSelect
  },
  {
    path: '/:id',
    name: 'Home',
    component: Editor
  }
]
const router = new VueRouter({
  mode: 'history',
  base: window.__POWERED_BY_QIANKUN__
    ? '/subapp/designable' + process.env.BASE_URL
    : process.env.BASE_URL,
  routes
})

export default router
